
cd "C:\Users\lenovo\Desktop\WongLiangPOBE\WongLiangStudy1\WongLiangStudy1multistate" 

*======starting from recommended comments (positive), through skip comments (ignore), ending with netizens comments (negative)===========================

use "ndf1",clear

*starting from positive, through ignore, ending with negative

msset , id(id) states(ignore negative) times (t_ignore t_negative ) covariates( male age ccp edu income poli_interest news_consumption frequent_use most_recent_use discussion)

mat tmat = r(transmatrix)

* display transition matrix
matlist tmat 

*             | to                              
*             | start(positive)  ignore    negtive 
*-------------+---------------------------------
*from         |                                 
*  start(pos) |         .          1          2 
*      ignore |         .          .          3 
*     negtive |         .          .          . 


* Declare data to be survival-time data
stset _stop, enter(_start) failure(_status=1)

* Parametric survival models with weibull distribution. No hazard ratio reported but coefficients. 
streg male age ccp edu income poli_interest news_consumption frequent_use most_recent_use discussion _trans2 _trans3, dist(weibull) nohr vce(cluster id)

* Generate survival model graph Figure 6 - Study 1
predictms , transmat(tmat) ci graph
